<?php
class ForgotPasswordForm extends CFormModel
{
    public $email;

    public function rules()
    {
        return array(
            array('email','userExists'),
        );
    }
    public function attributeLabels()
    {
        return array(
            'email' => Yii::t('site','Email'),
        );
    }
    public function userExists($attribute,$params)
    {
        $user = User::model()->findByAttributes(array('email'=>$this->email));
        if($user==null)
            $this->addError('email',Yii::t('site',"The user with the email {email} doesn't exist",array('{email}'=>$this->email)));
    }

}
/* vim:set ai sw=4 sts=4 et fdm=marker fdc=4: */
